package com.rw.test.restful;

import com.rw.engine.sign.anno.SignLimit;
import com.rw.engine.sign.anno.SignParam;
import com.rw.test.vo.ResultVO;
import com.rw.test.vo.TestVO;
import com.rw.test.vo.complex.MaiMai;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 签名校验测试
 */
@RestController
@RequestMapping("/RWdaze/SignTestController")
public class SignTestController {
    @GetMapping("/passGet")
    @SignLimit
    public ResultVO<String> passSignGetTest(@SignParam("id") int id,
                                            @SignParam("msg") String msg,
                                            @SignParam("sign") String sign) {
        return new ResultVO<>(0, "success");
    }

    @PostMapping("/passPost")
    @SignLimit
    public ResultVO<String> passSignPostTest(@RequestBody @SignParam TestVO testVO) {
        return new ResultVO<>(0, "success");
    }

    @PostMapping("/complex")
    @SignLimit
    public ResultVO<String> complexTest(@RequestBody @SignParam MaiMai maimai,
                                        @SignParam("sign") String sign) {
        return new ResultVO<>(0, "success");
    }

    @PostMapping("/complexList")
    @SignLimit
    public ResultVO<String> complexListTest(@RequestBody @SignParam List<MaiMai> maimaiList,
                                            @SignParam("sign") String sign) {
        return new ResultVO<>(0, "success");
    }
}
